package com.newlink.building.secret.adapter

import android.widget.TextView
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.viewholder.BaseViewHolder
import com.newlink.building.secret.R
import com.newlink.building.secret.bean.Module_Secret_MutipleSelectBean

/**
 * Created by xiaodong on 2022/8/30.
 */
class Module_Secret_DayOfWeekAdapter(data: MutableList<Module_Secret_MutipleSelectBean>) :
    BaseQuickAdapter<Module_Secret_MutipleSelectBean, BaseViewHolder>(R.layout.item_day_of_week, data) {
    init {
        addChildClickViewIds(R.id.tv_item)
    }

    override fun convert(holder: BaseViewHolder, item: Module_Secret_MutipleSelectBean) {
        holder.setText(R.id.tv_item, item.name)
        val textView = holder.getView<TextView>(R.id.tv_item)
        when (item.isChecked) {
            true -> {
                textView.setTextColor(context.getColor(R.color.white))
                textView.setBackgroundResource(R.drawable.shape_repeat_sub_selected)
            }

            false -> {
                textView.setTextColor(context.getColor(R.color.color_3030300))
                textView.setBackgroundResource(R.drawable.shape_repeat_sub_normal)
            }
        }
    }
}